/**
 * UsersAction.java
 *
 * Copyright (c) 2010 Prj.Manager All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of Prj.Manager .
 **/
package ro.prjmanager.web.actions;

import ro.prjmanager.core.annotations.Column;
import ro.prjmanager.core.annotations.EditOptions;
import ro.prjmanager.core.annotations.Id;
import ro.prjmanager.core.annotations.List;
import ro.prjmanager.model.Users;
import ro.prjmanager.web.annotation.NomenclatorTarget;
import ro.prjmanager.web.annotation.Service;

@Service(target = "usersService")
@NomenclatorTarget(addTarget = "add",deleteTarget = "del",editTarget = "edit",
        resource = "/pages/nomenclators/users/users.jsp",
        onFaildReturn = "/pages/nomenclators/users/users.jsp")
@List(serviceName = "usersService",
        caption = "Users List",
        editUrl = "%context_path%/actions/Users.action",
        id = "1", height = 200, rowNum = 10,
        url = "%context_path%/users.lst")
public class UsersAction extends GenericAction<Users> {

    @Id
    private Long idL;

    @Column(name = "userName", caption = "USER_NAME", index = "userName", width = 150, editOptions = @EditOptions(pos = 2   ))
    private java.lang.String userName;

    @Column(name = "password", caption = "PASSWORD", index = "password", width = 150, editOptions = @EditOptions(pos = 3  ,cols = 20, rows = 4, edittype = "textarea" ))
    private java.lang.String password;

    @Column(name = "firstName", caption = "FIRST_NAME", index = "firstName", width = 150, editOptions = @EditOptions(pos = 4  ,cols = 20, rows = 4, edittype = "textarea" ))
    private java.lang.String firstName;

    @Column(name = "lastName", caption = "LAST_NAME", index = "lastName", width = 150, editOptions = @EditOptions(pos = 5  ,cols = 20, rows = 4, edittype = "textarea" ))
    private java.lang.String lastName;

    @Column(name = "email", caption = "EMAIL", index = "email", width = 150, editOptions = @EditOptions(pos = 6  ,cols = 20, rows = 4, edittype = "textarea" ))
    private java.lang.String email;

    public Long getIdL() {
        if(getId()!=null&&!getId().isEmpty()&&!getId().equals("_empty"))
          idL=Long.valueOf(getId());
        return idL;
    }

    public void setIdL(Long idL) {
        this.idL = idL;
        if(idL!=null)
            this.setId(String.valueOf(idL));
    }

    /**
     * This method gets the userName attribute
     * @return - an  java.lang.String  object
     **/
    public  java.lang.String  getUserName(){
        return this.userName;
    }

    /**
     * The setter for the userName attribute
     * @param userName -  an  java.lang.String  object
     **/
    public void setUserName( java.lang.String  userName){
        this.userName=userName;
    }
    /**
     * This method gets the password attribute
     * @return - an  java.lang.String  object
     **/
    public  java.lang.String  getPassword(){
        return this.password;
    }

    /**
     * The setter for the password attribute
     * @param password -  an  java.lang.String  object
     **/
    public void setPassword( java.lang.String  password){
        this.password=password;
    }
    /**
     * This method gets the firstName attribute
     * @return - an  java.lang.String  object
     **/
    public  java.lang.String  getFirstName(){
        return this.firstName;
    }

    /**
     * The setter for the firstName attribute
     * @param firstName -  an  java.lang.String  object
     **/
    public void setFirstName( java.lang.String  firstName){
        this.firstName=firstName;
    }
    /**
     * This method gets the lastName attribute
     * @return - an  java.lang.String  object
     **/
    public  java.lang.String  getLastName(){
        return this.lastName;
    }

    /**
     * The setter for the lastName attribute
     * @param lastName -  an  java.lang.String  object
     **/
    public void setLastName( java.lang.String  lastName){
        this.lastName=lastName;
    }
    /**
     * This method gets the email attribute
     * @return - an  java.lang.String  object
     **/
    public  java.lang.String  getEmail(){
        return this.email;
    }

    /**
     * The setter for the email attribute
     * @param email -  an  java.lang.String  object
     **/
    public void setEmail( java.lang.String  email){
        this.email=email;
    }


    public void add() {
        Users adderObj=getModel();
        getService().create(adderObj);

    }
    public void edit() {
         Users editObj=getModel();
        getService().update(editObj);
    }

}
